﻿using System;
using System.Windows;
using System.Windows.Controls;
//using SomethingSpacialClassLib.Web;
using SomethingSpacial.Web;
using SomethingSpacial.ViewModel;


namespace SomethingSpacial.Views.Admin
{
    public partial class SponsorAdd : ChildWindow
    {
        //public  SponsorViewModel NewSponsor { get; set; }
        public SponsorsViewModel NewSponsor = new SponsorsViewModel();
        //SomethingSpacialContext domainContext = new SomethingSpacialContext();

        public SponsorAdd()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(SponsorAdd_Loaded);
            this.Closed += new EventHandler(SponsorAdd_Closed);
 
        }

        void SponsorAdd_Closed(object sender, EventArgs e)
        {
            if (this.DialogResult != true)
            {
                
                NewSponsor = null;
             //   addSponsorDataForm.CancelEdit();
            }
        }

        void SponsorAdd_Loaded(object sender, RoutedEventArgs e)
        {

            NewSponsor = new SponsorsViewModel();

           NewSponsor.SponsorID = 0;
           NewSponsor.SponsorName = "New Test Sponsor";
           NewSponsor.IsActive = true;
           NewSponsor.SponsorDescription = "This is a Sponsor Description";
           //NewSponsor.LogoImage = new ushort("Microsoft.jpg");
           NewSponsor.SponsorURL = "http://www.Microsoft.com";

            addSponsorDataForm.CurrentItem = NewSponsor;
            addSponsorDataForm.BeginEdit();    
      
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
           // addSponsorDataForm.CommitEdit();
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }



    }
}

